home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_ncurses.idb / usr / freeware / include / ncurses / ncurses.h.z / ncurses.h
Encoding:
C/C++ Source or Header  |  1999-07-16  |  57.5 KB  |  1,332 lines

  1. /****************************************************************************
  2.  * Copyright (c) 1998 Free Software Foundation, Inc.                        *
  3.  *                                                                          *
  4.  * Permission is hereby granted, free of charge, to any person obtaining a  *
  5.  * copy of this software and associated documentation files (the            *
  6.  * "Software"), to deal in the Software without restriction, including      *
  7.  * without limitation the rights to use, copy, modify, merge, publish,      *
  8.  * distribute, distribute with modifications, sublicense, and/or sell       *
  9.  * copies of the Software, and to permit persons to whom the Software is    *
  10.  * furnished to do so, subject to the following conditions:                 *
  11.  *                                                                          *
  12.  * The above copyright notice and this permission notice shall be included  *
  13.  * in all copies or substantial portions of the Software.                   *
  14.  *                                                                          *
  15.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
  16.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
  17.  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
  18.  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
  19.  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
  20.  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
  21.  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
  22.  *                                                                          *
  23.  * Except as contained in this notice, the name(s) of the above copyright   *
  24.  * holders shall not be used in advertising or otherwise to promote the     *
  25.  * sale, use or other dealings in this Software without prior written       *
  26.  * authorization.                                                           *
  27.  ****************************************************************************/
  28.  
  29. /****************************************************************************
  30.  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
  31.  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
  32.  ****************************************************************************/
  33.  
  34. /* $Id: curses.h.in,v 1.60 1998/02/11 12:13:46 tom Exp $ */
  35.  
  36. #ifndef __NCURSES_H
  37. #define __NCURSES_H
  38.  
  39. #define CURSES 1
  40. #define CURSES_H 1
  41.  
  42. /* This should be defined for the enhanced functionality to be visible.
  43.  * However, none of the wide-character (enhanced) functionality is implemented.
  44.  * So we do not define it (yet).
  45. #define _XOPEN_CURSES 1
  46.  */
  47.  
  48. /* These are defined only in curses.h, and are used for conditional compiles */
  49. #define NCURSES_VERSION_MAJOR 4
  50. #define NCURSES_VERSION_MINOR 2
  51. #define NCURSES_VERSION_PATCH 980228
  52.  
  53. /* This is defined in more than one ncurses header, for identification */
  54. #undef  NCURSES_VERSION
  55. #define NCURSES_VERSION "4.2"
  56.  
  57. #ifdef NCURSES_NOMACROS
  58. #define NCURSES_ATTR_T attr_t
  59. #endif
  60.  
  61. #ifndef NCURSES_ATTR_T
  62. #define NCURSES_ATTR_T int
  63. #endif
  64.  
  65. #ifndef NCURSES_CONST
  66. #define NCURSES_CONST /* nothing */
  67. #endif
  68.  
  69. typedef unsigned long chtype;
  70.  
  71. #include <stdio.h>
  72. #include <unctrl.h>
  73. #include <stdarg.h>    /* we need va_list */
  74. #ifdef _XOPEN_SOURCE_EXTENDED
  75. #include <stddef.h>    /* we want wchar_t */
  76. #endif /* _XOPEN_SOURCE_EXTENDED */
  77.  
  78. /* XSI and SVr4 specify that curses implements 'bool'.  However, C++ may also
  79.  * implement it.  If so, we must use the C++ compiler's type to avoid conflict
  80.  * with other interfaces.
  81.  *
  82.  * To simplify use with/without the configuration script, we define the symbols
  83.  * CXX_BUILTIN_BOOL and CXX_TYPE_OF_BOOL; they're edited by the configure
  84.  * script.
  85.  */
  86.  
  87. #undef TRUE
  88. #undef FALSE
  89. #define CXX_BUILTIN_BOOL 1
  90. #define CXX_TYPE_OF_BOOL char
  91.  
  92. #if defined(__cplusplus) && CXX_BUILTIN_BOOL
  93. #define TRUE    ((CXX_TYPE_OF_BOOL)true)
  94. #define FALSE   ((CXX_TYPE_OF_BOOL)false)
  95. #else
  96. typedef CXX_TYPE_OF_BOOL bool;
  97. #define TRUE    ((bool)1)
  98. #define FALSE   ((bool)0)
  99. #endif
  100.  
  101. #ifdef __cplusplus
  102. extern "C" {
  103. #endif
  104.  
  105. /*
  106.  * XSI attributes.  In the ncurses implementation, they are identical to the
  107.  * A_ attributes.
  108.  */
  109. #define WA_ATTRIBUTES    A_ATTRIBUTES
  110. #define WA_NORMAL    A_NORMAL
  111. #define WA_STANDOUT    A_STANDOUT
  112. #define WA_UNDERLINE    A_UNDERLINE
  113. #define WA_REVERSE    A_REVERSE
  114. #define WA_BLINK    A_BLINK
  115. #define WA_DIM        A_DIM
  116. #define WA_BOLD        A_BOLD
  117. #define WA_ALTCHARSET    A_ALTCHARSET
  118. #define WA_INVIS    A_INVIS
  119. #define WA_PROTECT    A_PROTECT
  120. #define WA_HORIZONTAL    A_HORIZONTAL
  121. #define WA_LEFT        A_LEFT
  122. #define WA_LOW        A_LOW
  123. #define WA_RIGHT    A_RIGHT
  124. #define WA_TOP        A_TOP
  125. #define WA_VERTICAL    A_VERTICAL
  126.  
  127. /* colors */
  128. extern int COLORS;
  129. extern int COLOR_PAIRS;
  130.  
  131. #define COLOR_BLACK    0
  132. #define COLOR_RED    1
  133. #define COLOR_GREEN    2
  134. #define COLOR_YELLOW    3
  135. #define COLOR_BLUE    4
  136. #define COLOR_MAGENTA    5
  137. #define COLOR_CYAN    6
  138. #define COLOR_WHITE    7
  139.  
  140. /* line graphics */
  141.  
  142. extern    chtype acs_map[];
  143.  
  144. /* VT100 symbols begin here */
  145. #define ACS_ULCORNER    (acs_map['l'])    /* upper left corner */
  146. #define ACS_LLCORNER    (acs_map['m'])    /* lower left corner */
  147. #define ACS_URCORNER    (acs_map['k'])    /* upper right corner */
  148. #define ACS_LRCORNER    (acs_map['j'])    /* lower right corner */
  149. #define ACS_LTEE    (acs_map['t'])    /* tee pointing right */
  150. #define ACS_RTEE    (acs_map['u'])    /* tee pointing left */
  151. #define ACS_BTEE    (acs_map['v'])    /* tee pointing up */
  152. #define ACS_TTEE    (acs_map['w'])    /* tee pointing down */
  153. #define ACS_HLINE    (acs_map['q'])    /* horizontal line */
  154. #define ACS_VLINE    (acs_map['x'])    /* vertical line */
  155. #define ACS_PLUS    (acs_map['n'])    /* large plus or crossover */
  156. #define ACS_S1        (acs_map['o'])    /* scan line 1 */
  157. #define ACS_S9        (acs_map['s'])    /* scan line 9 */
  158. #define ACS_DIAMOND    (acs_map['`'])    /* diamond */
  159. #define ACS_CKBOARD    (acs_map['a'])    /* checker board (stipple) */
  160. #define ACS_DEGREE    (acs_map['f'])    /* degree symbol */
  161. #define ACS_PLMINUS    (acs_map['g'])    /* plus/minus */
  162. #define ACS_BULLET    (acs_map['~'])    /* bullet */
  163. /* Teletype 5410v1 symbols begin here */
  164. #define ACS_LARROW    (acs_map[','])    /* arrow pointing left */
  165. #define ACS_RARROW    (acs_map['+'])    /* arrow pointing right */
  166. #define ACS_DARROW    (acs_map['.'])    /* arrow pointing down */
  167. #define ACS_UARROW    (acs_map['-'])    /* arrow pointing up */
  168. #define ACS_BOARD    (acs_map['h'])    /* board of squares */
  169. #define ACS_LANTERN    (acs_map['i'])    /* lantern symbol */
  170. #define ACS_BLOCK    (acs_map['0'])    /* solid square block */
  171. /*
  172.  * These aren't documented, but a lot of System Vs have them anyway
  173.  * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
  174.  * The ACS_names may not match AT&T's, our source didn't know them.
  175.  */
  176. #define ACS_S3        (acs_map['p'])    /* scan line 3 */
  177. #define ACS_S7        (acs_map['r'])    /* scan line 7 */
  178. #define ACS_LEQUAL    (acs_map['y'])    /* less/equal */
  179. #define ACS_GEQUAL    (acs_map['z'])    /* greater/equal */
  180. #define ACS_PI        (acs_map['{'])    /* Pi */
  181. #define ACS_NEQUAL    (acs_map['|'])    /* not equal */
  182. #define ACS_STERLING    (acs_map['}'])    /* UK pound sign */
  183.  
  184. /*
  185.  * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
  186.  * is the right, b is the bottom, and l is the left.  t, r, b, and l might
  187.  * be B (blank), S (single), D (double), or T (thick).  The subset defined
  188.  * here only uses B and S.
  189.  */
  190. #define ACS_BSSB    ACS_ULCORNER
  191. #define ACS_SSBB    ACS_LLCORNER
  192. #define ACS_BBSS    ACS_URCORNER
  193. #define ACS_SBBS    ACS_LRCORNER
  194. #define ACS_SBSS    ACS_RTEE
  195. #define ACS_SSSB    ACS_LTEE
  196. #define ACS_SSBS    ACS_BTEE
  197. #define ACS_BSSS    ACS_TTEE
  198. #define ACS_BSBS    ACS_HLINE
  199. #define ACS_SBSB    ACS_VLINE
  200. #define ACS_SSSS    ACS_PLUS
  201.  
  202. #if    !defined(ERR) || ((ERR) != -1)
  203. #define ERR     (-1)
  204. #endif
  205.  
  206. #if    !defined(OK) || ((OK) != 0)
  207. #define OK      (0)
  208. #endif
  209.  
  210. /* values for the _flags member */
  211. #define _SUBWIN         0x01    /* is this a sub-window? */
  212. #define _ENDLINE        0x02    /* is the window flush right? */
  213. #define _FULLWIN        0x04    /* is the window full-screen? */
  214. #define _SCROLLWIN      0x08    /* bottom edge is at screen bottom? */
  215. #define _ISPAD            0x10    /* is this window a pad? */
  216. #define _HASMOVED       0x20    /* has cursor moved since last refresh? */
  217. #define _WRAPPED        0x40    /* cursor was just wrappped */
  218.  
  219. /*
  220.  * this value is used in the firstchar and lastchar fields to mark
  221.  * unchanged lines
  222.  */
  223. #define _NOCHANGE       -1
  224.  
  225. /*
  226.  * this value is used in the oldindex field to mark lines created by insertions
  227.  * and scrolls.
  228.  */
  229. #define _NEWINDEX    -1
  230.  
  231. typedef struct screen  SCREEN;
  232. typedef struct _win_st WINDOW;
  233.  
  234. typedef    chtype    attr_t;        /* ...must be at least as wide as chtype */
  235.  
  236. #ifdef _XOPEN_SOURCE_EXTENDED
  237. #ifndef _WCHAR_T
  238. typedef unsigned long wchar_t;
  239. #endif /* _WCHAR_T */
  240. #ifndef _WINT_T
  241. typedef long int wint_t;
  242. #endif /* _WINT_T */
  243.  
  244. #define CCHARW_MAX    5
  245. typedef struct
  246. {
  247.     attr_t    attr;
  248.     wchar_t    chars[CCHARW_MAX];
  249. }
  250. cchar_t;
  251. #endif /* _XOPEN_SOURCE_EXTENDED */
  252.  
  253. struct ldat
  254. {
  255.     chtype  *text;        /* text of the line */
  256.     short   firstchar;    /* first changed character in the line */
  257.     short   lastchar;    /* last changed character in the line */
  258.     short   oldindex;    /* index of the line at last update */
  259. };
  260.  
  261. struct _win_st
  262. {
  263.     short   _cury, _curx;    /* current cursor position */
  264.  
  265.     /* window location and size */
  266.     short   _maxy, _maxx;    /* maximums of x and y, NOT window size */
  267.     short   _begy, _begx;    /* screen coords of upper-left-hand corner */
  268.  
  269.     short   _flags;        /* window state flags */
  270.  
  271.     /* attribute tracking */
  272.     attr_t  _attrs;        /* current attribute for non-space character */
  273.     chtype  _bkgd;        /* current background char/attribute pair */
  274.  
  275.     /* option values set by user */
  276.     bool    _notimeout;    /* no time out on function-key entry? */
  277.     bool    _clear;        /* consider all data in the window invalid? */
  278.     bool    _leaveok;    /* OK to not reset cursor on exit? */
  279.     bool    _scroll;    /* OK to scroll this window? */
  280.     bool    _idlok;        /* OK to use insert/delete line? */
  281.     bool    _idcok;        /* OK to use insert/delete char? */
  282.     bool    _immed;        /* window in immed mode? (not yet used) */
  283.     bool    _sync;        /* window in sync mode? */
  284.     bool    _use_keypad;    /* process function keys into KEY_ symbols? */
  285.     int    _delay;        /* 0 = nodelay, <0 = blocking, >0 = delay */
  286.  
  287.     struct ldat *_line;    /* the actual line data */
  288.  
  289.     /* global screen state */
  290.     short    _regtop;    /* top line of scrolling region */
  291.     short    _regbottom;    /* bottom line of scrolling region */
  292.  
  293.     /* these are used only if this is a sub-window */
  294.     int    _parx;        /* x coordinate of this window in parent */
  295.     int    _pary;        /* y coordinate of this window in parent */
  296.     WINDOW    *_parent;    /* pointer to parent if a sub-window */
  297.  
  298.     /* these are used only if this is a pad */
  299.     struct pdat
  300.     {
  301.         short _pad_y,      _pad_x;
  302.         short _pad_top,    _pad_left;
  303.         short _pad_bottom, _pad_right;
  304.     } _pad;
  305.  
  306.     short   _yoffset;    /* real begy is _begy + _yoffset */
  307. };
  308.  
  309. extern WINDOW   *stdscr;
  310. extern WINDOW   *curscr;
  311. extern WINDOW   *newscr;
  312.  
  313. extern int    LINES;
  314. extern int    COLS;
  315. extern int    TABSIZE;
  316.  
  317. /*
  318.  * This global was an undocumented feature under AIX curses.
  319.  */
  320. extern int ESCDELAY;    /* ESC expire time in milliseconds */
  321.  
  322. /* non-XSI extensions (dickey@clark.net) */
  323. extern int define_key (char *, int);
  324. extern int keyok (int, bool);
  325. extern int resizeterm (int, int);
  326. extern int use_default_colors (void);
  327. extern int wresize (WINDOW *, int, int);
  328.  
  329. extern char ttytype[];        /* needed for backward compatibility */
  330.  
  331. /*
  332.  * GCC (and some other compilers) define '__attribute__'; we're using this
  333.  * macro to alert the compiler to flag inconsistencies in printf/scanf-like
  334.  * function calls.  Just in case '__attribute__' isn't defined, make a dummy.
  335.  * G++ doesn't accept it anyway.
  336.  */
  337. #if defined(__cplusplus) || (!defined(__GNUC__) && !defined(__attribute__))
  338. #define __attribute__(p) /* nothing */
  339. #endif
  340.  
  341. /*
  342.  * We cannot define these in ncurses_cfg.h, since they require parameters to be
  343.  * passed (that's non-portable).
  344.  */
  345. #if    GCC_PRINTF
  346. #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
  347. #else
  348. #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
  349. #endif
  350.  
  351. #if    GCC_SCANF
  352. #define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
  353. #else
  354. #define GCC_SCANFLIKE(fmt,var)  /*nothing*/
  355. #endif
  356.  
  357. #ifndef    GCC_NORETURN
  358. #define    GCC_NORETURN /* nothing */
  359. #endif
  360.  
  361. #ifndef    GCC_UNUSED
  362. #define    GCC_UNUSED /* nothing */
  363. #endif
  364.  
  365. /*
  366.  * Function prototypes.  This is the complete XSI Curses list of required
  367.  * functions.  Those marked `generated' will have sources generated from the
  368.  * macro definitions later in this file, in order to satisfy XPG4.2
  369.  * requirements.
  370.  */
  371.  
  372. extern int addch(const chtype);                /* generated */
  373. extern int addchnstr(const chtype *, int);        /* generated */
  374. extern int addchstr(const chtype *);            /* generated */
  375. extern int addnstr(const char *, int);            /* generated */
  376. extern int addstr(const char *);            /* generated */
  377. #ifdef _XOPEN_SOURCE_EXTENDED
  378. extern int addnwstr(const wchar_t *, int);        /* missing */
  379. extern int addwstr(const wchar_t *);            /* missing */
  380. extern int add_wch(const cchar_t *);            /* missing */
  381. extern int add_wchnstr(const cchar_t *, int);        /* missing */
  382. extern int add_wchstr(const cchar_t *);            /* missing */
  383. #endif /* _XOPEN_SOURCE_EXTENDED */
  384. extern int attroff(NCURSES_ATTR_T);            /* generated */
  385. extern int attron(NCURSES_ATTR_T);            /* generated */
  386. extern int attrset(NCURSES_ATTR_T);            /* generated */
  387. extern int attr_get(void);                /* generated */
  388. extern int attr_off(NCURSES_ATTR_T);            /* generated */
  389. extern int attr_on(NCURSES_ATTR_T);            /* generated */
  390. extern int attr_set(NCURSES_ATTR_T);            /* generated */
  391. extern int baudrate(void);                /* implemented */
  392. extern int beep(void);                    /* implemented */
  393. extern int bkgd(chtype);                /* generated */
  394. extern void bkgdset(chtype);                /* generated */
  395. #ifdef _XOPEN_SOURCE_EXTENDED
  396. extern int bkgrndset(const cchar_t *);            /* missing */
  397. extern int bkgrnd(const cchar_t *);            /* missing */
  398. #endif /* _XOPEN_SOURCE_EXTENDED */
  399. extern int border(chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);    /* generated */
  400. #ifdef _XOPEN_SOURCE_EXTENDED
  401. extern int border_set(cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t);    /* missing */
  402. #endif /* _XOPEN_SOURCE_EXTENDED */
  403. extern int box(WINDOW *, chtype, chtype);        /* generated */
  404. #ifdef _XOPEN_SOURCE_EXTENDED
  405. extern int box_set(WINDOW *, cchar_t, cchar_t);        /* missing */
  406. #endif /* _XOPEN_SOURCE_EXTENDED */
  407. extern bool can_change_color(void);            /* implemented */
  408. extern int cbreak(void);                /* implemented */
  409. extern int chgat(int, attr_t, short, const void *);    /* generated */
  410. extern int clear(void);                    /* generated */
  411. extern int clearok(WINDOW *,bool);            /* implemented */
  412. extern int clrtobot(void);                /* generated */
  413. extern int clrtoeol(void);                /* generated */
  414. extern int color_content(short,short*,short*,short*);    /* implemented */
  415. extern int color_set(short,void*);            /* missing */
  416. extern int COLOR_PAIR(int);                /* generated */
  417. extern int copywin(const WINDOW*,WINDOW*,int,int,int,int,int,int,int);    /* implemented */
  418. extern int curs_set(int);                /* implemented */
  419. extern int def_prog_mode(void);                /* implemented */
  420. extern int def_shell_mode(void);            /* implemented */
  421. extern int delay_output(int);                /* implemented */
  422. extern int delch(void);                    /* generated */
  423. extern void delscreen(SCREEN *);            /* implemented */
  424. extern int delwin(WINDOW *);                /* implemented */
  425. extern int deleteln(void);                /* generated */
  426. extern WINDOW *derwin(WINDOW *,int,int,int,int);    /* implemented */
  427. extern int doupdate(void);                /* implemented */
  428. extern WINDOW *dupwin(WINDOW *);            /* implemented */
  429. extern int echo(void);                    /* implemented */
  430. extern int echochar(const chtype);            /* generated */
  431. #ifdef _XOPEN_SOURCE_EXTENDED
  432. extern int echo_wchar(const cchar_t *);            /* missing */
  433. extern int erasewchar(wchar_t*);            /* missing */
  434. #endif /* _XOPEN_SOURCE_EXTENDED */
  435. extern int endwin(void);                /* implemented */
  436. extern char erasechar(void);                /* implemented */
  437. #ifdef _XOPEN_SOURCE_EXTENDED
  438. extern int erase_wchar(wchar_t *);            /* missing */
  439. #endif /* _XOPEN_SOURCE_EXTENDED */
  440. extern void filter(void);                /* implemented */
  441. extern int flash(void);                    /* implemented */
  442. extern int flushinp(void);                /* implemented */
  443. extern chtype getbkgd(WINDOW *);            /* generated */
  444. #ifdef _XOPEN_SOURCE_EXTENDED
  445. extern int getbkgrnd(cchar_t *);            /* missing */
  446. extern int getcchar(const cchar_t *, wchar_t*, attr_t*, short*, void*);    /* missing */
  447. #endif /* _XOPEN_SOURCE_EXTENDED */
  448. extern int getch(void);                    /* generated */
  449. extern int getnstr(char *, int);            /* generated */
  450. #ifdef _XOPEN_SOURCE_EXTENDED
  451. extern int getn_wstr(wint_t *, int);            /* missing */
  452. #endif /* _XOPEN_SOURCE_EXTENDED */
  453. extern int getstr(char *);                /* generated */
  454. #ifdef _XOPEN_SOURCE_EXTENDED
  455. extern int get_wch(wint_t *);                /* missing */
  456. #endif /* _XOPEN_SOURCE_EXTENDED */
  457. extern WINDOW *getwin(FILE *);                /* implemented */
  458. #ifdef _XOPEN_SOURCE_EXTENDED
  459. extern int get_wstr(wint_t *);                /* missing */
  460. #endif /* _XOPEN_SOURCE_EXTENDED */
  461. extern int halfdelay(int);                /* implemented */
  462. extern bool has_colors(void);                /* implemented */
  463. extern int has_ic(void);                /* implemented */
  464. extern int has_il(void);                /* implemented */
  465. extern int hline(chtype, int);                /* generated */
  466. #ifdef _XOPEN_SOURCE_EXTENDED
  467. extern int hline_set(const cchar_t *, int);        /* missing */
  468. #endif /* _XOPEN_SOURCE_EXTENDED */
  469. extern void idcok(WINDOW *, bool);            /* implemented */
  470. extern int idlok(WINDOW *, bool);            /* implemented */
  471. extern void immedok(WINDOW *, bool);            /* implemented */
  472. extern chtype inch(void);                /* generated */
  473. extern int inchnstr(chtype *, int);            /* generated */
  474. extern int inchstr(chtype *);                /* generated */
  475. extern WINDOW *initscr(void);                /* implemented */
  476. extern int init_color(short,short,short,short);        /* implemented */
  477. extern int init_pair(short,short,short);        /* implemented */
  478. extern int innstr(char *, int);                /* generated */
  479. #ifdef _XOPEN_SOURCE_EXTENDED
  480. extern int innwstr(wchar_t *, int);            /* missing */
  481. #endif /* _XOPEN_SOURCE_EXTENDED */
  482. extern int insch(chtype);                /* generated */
  483. extern int insdelln(int);                /* generated */
  484. extern int insertln(void);                /* generated */
  485. extern int insnstr(const char *, int);            /* generated */
  486. extern int insstr(const char *);            /* generated */
  487. extern int instr(char *);                /* generated */
  488. #ifdef _XOPEN_SOURCE_EXTENDED
  489. extern int ins_nwstr(const wchar_t *, int);        /* missing */
  490. extern int ins_wch(const cchar_t *);            /* missing */
  491. extern int ins_wstr(const wchar_t *);            /* missing */
  492. #endif /* _XOPEN_SOURCE_EXTENDED */
  493. extern int intrflush(WINDOW *,bool);            /* implemented */
  494. #ifdef _XOPEN_SOURCE_EXTENDED
  495. extern int inwstr(wchar_t *);                /* missing */
  496. extern int in_wch(const cchar_t *);            /* missing */
  497. extern int in_wchstr(const cchar_t *);            /* missing */
  498. extern int in_wchntr(const cchar_t *, int);        /* missing */
  499. #endif /* _XOPEN_SOURCE_EXTENDED */
  500. extern int isendwin(void);                /* implemented */
  501. extern int is_linetouched(WINDOW *,int);        /* implemented */
  502. extern int is_wintouched(WINDOW *);            /* implemented */
  503. extern const char *keyname(int);            /* implemented */
  504. #ifdef _XOPEN_SOURCE_EXTENDED
  505. extern int key_name(wchar_t *);                /* missing */
  506. #endif /* _XOPEN_SOURCE_EXTENDED */
  507. extern int keypad(WINDOW *,bool);            /* implemented */
  508. extern char killchar(void);                /* implemented */
  509. #ifdef _XOPEN_SOURCE_EXTENDED
  510. extern int killwchar(wchar_t *);            /* missing */
  511. #endif /* _XOPEN_SOURCE_EXTENDED */
  512. extern int leaveok(WINDOW *,bool);            /* implemented */
  513. extern char *longname(void);                /* implemented */
  514. extern int meta(WINDOW *,bool);                /* implemented */
  515. extern int move(int, int);                /* generated */
  516. extern int mvaddch(int, int, const chtype);        /* generated */
  517. extern int mvaddchnstr(int, int, const chtype *, int);    /* generated */
  518. extern int mvaddchstr(int, int, const chtype *);    /* generated */
  519. extern int mvaddnstr(int, int, const char *, int);    /* generated */
  520. extern int mvaddstr(int, int, const char *);        /* generated */
  521. #ifdef _XOPEN_SOURCE_EXTENDED
  522. extern int mvaddnwstr(int, int, const wchar_t *, int);    /* missing */
  523. extern int mvaddwstr(int, int, const wchar_t *);    /* missing */
  524. extern int mvadd_wch(int, int, const cchar_t *);    /* missing */
  525. extern int mvadd_wchnstr(int, int, const cchar_t *, int);/* missing */
  526. extern int mvadd_wchstr(int, int, const cchar_t *);    /* missing */
  527. #endif /* _XOPEN_SOURCE_EXTENDED */
  528. extern int mvchgat(int, int, int, attr_t, short, const void *);    /* generated */
  529. extern int mvcur(int,int,int,int);            /* implemented */
  530. extern int mvdelch(int, int);                /* generated */
  531. extern int mvderwin(WINDOW *, int, int);        /* implemented */
  532. extern int mvgetch(int, int);                /* generated */
  533. extern int mvgetnstr(int, int, char *, int);        /* generated */
  534. #ifdef _XOPEN_SOURCE_EXTENDED
  535. extern int mvgetn_wstr(int, int, wint_t *, int);    /* missing */
  536. #endif /* _XOPEN_SOURCE_EXTENDED */
  537. extern int mvgetstr(int, int, char *);            /* generated */
  538. #ifdef _XOPEN_SOURCE_EXTENDED
  539. extern int mvget_wch(int, int, wint_t *);        /* missing */
  540. #endif /* _XOPEN_SOURCE_EXTENDED */
  541. #ifdef _XOPEN_SOURCE_EXTENDED
  542. extern int mvget_wstr(int, int, wint_t *);        /* missing */
  543. #endif /* _XOPEN_SOURCE_EXTENDED */
  544. extern int mvhline(int, int, chtype, int);        /* generated */
  545. #ifdef _XOPEN_SOURCE_EXTENDED
  546. extern int mvhline_set(int, int, const cchar_t *, int);    /* missing */
  547. #endif /* _XOPEN_SOURCE_EXTENDED */
  548. extern chtype mvinch(int, int);                /* generated */
  549. extern int mvinchnstr(int, int, chtype *, int);        /* generated */
  550. extern int mvinchstr(int, int, chtype *);        /* generated */
  551. extern int mvinnstr(int, int, char *, int);        /* generated */
  552. #ifdef _XOPEN_SOURCE_EXTENDED
  553. extern int mvinnwstr(int, int, wchar_t *, int);        /* missing */
  554. #endif /* _XOPEN_SOURCE_EXTENDED */
  555. extern int mvinsch(int, int, chtype);            /* generated */
  556. extern int mvinsnstr(int, int, const char *, int);    /* generated */
  557. extern int mvinsstr(int, int, const char *);        /* generated */
  558. extern int mvinstr(int, int, char *);            /* generated */
  559. #ifdef _XOPEN_SOURCE_EXTENDED
  560. extern int mvins_nwstr(int, int, const wchar_t *, int);    /* missing */
  561. extern int mvins_wch(int, int, const cchar_t *);    /* missing */
  562. extern int mvins_wstr(int, int, const wchar_t *);    /* missing */
  563. extern int mvinwstr(int, int, wchar_t *);        /* missing */
  564. extern int mvin_wch(int, int, const cchar_t *);        /* missing */
  565. extern int mvin_wchstr(int, int, const cchar_t *);    /* missing */
  566. extern int mvin_wchntr(int, int, const cchar_t *, int);    /* missing */
  567. #endif /* _XOPEN_SOURCE_EXTENDED */
  568. extern int mvprintw(int,int,const char *,...)        /* implemented */
  569.         GCC_PRINTFLIKE(3,4);
  570. extern int mvscanw(int,int,const char *,...)        /* implemented */
  571.         GCC_SCANFLIKE(3,4);
  572. extern int mvvline(int, int, chtype, int);        /* generated */
  573. #ifdef _XOPEN_SOURCE_EXTENDED
  574. extern int mvvline_set(int, int, const cchar_t *, int);    /* missing */
  575. #endif /* _XOPEN_SOURCE_EXTENDED */
  576. extern int mvwaddch(WINDOW *, int, int, const chtype);    /* generated */
  577. extern int mvwaddchnstr(WINDOW *, int, int, const chtype *, int);/* generated */
  578. extern int mvwaddchstr(WINDOW *, int, int, const chtype *);    /* generated */
  579. extern int mvwaddnstr(WINDOW *, int, int, const char *, int);    /* generated */
  580. extern int mvwaddstr(WINDOW *, int, int, const char *);    /* generated */
  581. #ifdef _XOPEN_SOURCE_EXTENDED
  582. extern int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int);/* missing */
  583. extern int mvwaddwstr(WINDOW *, int, int, const wchar_t *);    /* missing */
  584. extern int mvwadd_wch(WINDOW *, int, int, const cchar_t *);    /* missing */
  585. extern int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int); /* missing */
  586. extern int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *);    /* missing */
  587. #endif /* _XOPEN_SOURCE_EXTENDED */
  588. extern int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *);/* generated */
  589. extern int mvwdelch(WINDOW *, int, int);        /* generated */
  590. extern int mvwgetch(WINDOW *, int, int);        /* generated */
  591. extern int mvwgetnstr(WINDOW *, int, int, char *, int);    /* generated */
  592. #ifdef _XOPEN_SOURCE_EXTENDED
  593. extern int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int);/* missing */
  594. #endif /* _XOPEN_SOURCE_EXTENDED */
  595. extern int mvwgetstr(WINDOW *, int, int, char *);    /* generated */
  596. #ifdef _XOPEN_SOURCE_EXTENDED
  597. extern int mvwget_wch(WINDOW *, int, int, wint_t *);    /* missing */
  598. #endif /* _XOPEN_SOURCE_EXTENDED */
  599. #ifdef _XOPEN_SOURCE_EXTENDED
  600. extern int mvwget_wstr(WINDOW *, int, int, wint_t *);    /* missing */
  601. #endif /* _XOPEN_SOURCE_EXTENDED */
  602. extern int mvwhline(WINDOW *, int, int, chtype, int);    /* generated */
  603. #ifdef _XOPEN_SOURCE_EXTENDED
  604. extern int mvwhline_set(WINDOW *, int, int, const cchar_t *, int);/* missing */
  605. #endif /* _XOPEN_SOURCE_EXTENDED */
  606. extern int mvwin(WINDOW *,int,int);            /* implemented */
  607. extern chtype mvwinch(WINDOW *, int, int);            /* generated */
  608. extern int mvwinchnstr(WINDOW *, int, int, chtype *, int);    /* generated */
  609. extern int mvwinchstr(WINDOW *, int, int, chtype *);        /* generated */
  610. extern int mvwinnstr(WINDOW *, int, int, char *, int);        /* generated */
  611. #ifdef _XOPEN_SOURCE_EXTENDED
  612. extern int mvwinnwstr(WINDOW *, int, int, wchar_t *, int);    /* missing */
  613. #endif /* _XOPEN_SOURCE_EXTENDED */
  614. extern int mvwinsch(WINDOW *, int, int, chtype);        /* generated */
  615. extern int mvwinsnstr(WINDOW *, int, int, const char *, int);    /* generated */
  616. extern int mvwinsstr(WINDOW *, int, int, const char *);        /* generated */
  617. extern int mvwinstr(WINDOW *, int, int, char *);        /* generated */
  618. #ifdef _XOPEN_SOURCE_EXTENDED
  619. extern int mvwins_nwstr(WINDOW *, int,int, const wchar_t *,int); /* missing */
  620. extern int mvwins_wch(WINDOW *, int, int, const cchar_t *);    /* missing */
  621. extern int mvwins_wstr(WINDOW *, int, int, const wchar_t *);    /* missing */
  622. extern int mvwinwstr(WINDOW *, int, int, wchar_t *);        /* missing */
  623. extern int mvwin_wch(WINDOW *, int, int, const cchar_t *);    /* missing */
  624. extern int mvwin_wchnstr(WINDOW *, int,int,const cchar_t *,int); /* missing */
  625. extern int mvwin_wchstr(WINDOW *, int, int, const cchar_t *);    /* missing */
  626. #endif /* _XOPEN_SOURCE_EXTENDED */
  627. extern int mvwprintw(WINDOW*,int,int,const char *,...)    /* implemented */
  628.         GCC_PRINTFLIKE(4,5);
  629. extern int mvwscanw(WINDOW *,int,int,const char *,...)    /* implemented */
  630.         GCC_SCANFLIKE(4,5);
  631. extern int mvwvline(WINDOW *,int, int, chtype, int);    /* generated */
  632. #ifdef _XOPEN_SOURCE_EXTENDED
  633. extern int mvwvline_set(WINDOW *, int,int, const cchar_t *,int); /* missing */
  634. #endif /* _XOPEN_SOURCE_EXTENDED */
  635. extern int napms(int);                    /* implemented */
  636. extern WINDOW *newpad(int,int);                /* implemented */
  637. extern SCREEN *newterm(const char *,FILE *,FILE *);    /* implemented */
  638. extern WINDOW *newwin(int,int,int,int);            /* implemented */
  639. extern int nl(void);                    /* implemented */
  640. extern int nocbreak(void);                /* implemented */
  641. extern int nodelay(WINDOW *,bool);            /* implemented */
  642. extern int noecho(void);                /* implemented */
  643. extern int nonl(void);                    /* implemented */
  644. extern int noqiflush(void);                /* implemented */
  645. extern int noraw(void);                    /* implemented */
  646. extern int notimeout(WINDOW *,bool);            /* implemented */
  647. extern int overlay(const WINDOW*,WINDOW *);        /* implemented */
  648. extern int overwrite(const WINDOW*,WINDOW *);        /* implemented */
  649. extern int pair_content(short,short*,short*);        /* implemented */
  650. extern int PAIR_NUMBER(int);                /* generated */
  651. extern int pechochar(WINDOW *, const chtype);        /* implemented */
  652. #ifdef _XOPEN_SOURCE_EXTENDED
  653. extern int pecho_wchar(WINDOW *, const cchar_t *);    /* missing */
  654. #endif /* _XOPEN_SOURCE_EXTENDED */
  655. extern int pnoutrefresh(WINDOW*,int,int,int,int,int,int);/* implemented */
  656. extern int prefresh(WINDOW *,int,int,int,int,int,int);    /* implemented */
  657. extern int printw(const char *,...)            /* implemented */
  658.         GCC_PRINTFLIKE(1,2);
  659. extern int putp(const char *);                /* implemented */
  660. extern int putwin(WINDOW *, FILE *);            /* implemented */
  661. extern int qiflush(void);                /* implemented */
  662. extern int raw(void);                    /* implemented */
  663. extern int redrawwin(WINDOW *);                /* generated */
  664. extern int refresh(void);                /* generated */
  665. extern int resetty(void);                /* implemented */
  666. extern int reset_prog_mode(void);            /* implemented */
  667. extern int reset_shell_mode(void);            /* implemented */
  668. extern int ripoffline(int, int (*init)(WINDOW *, int));    /* implemented */
  669. extern int savetty(void);                /* implemented */
  670. extern int scanw(const char *,...)            /* implemented */
  671.         GCC_SCANFLIKE(1,2);
  672. extern int scr_dump(const char *);            /* implemented */
  673. extern int scr_init(const char *);            /* implemented */
  674. extern int scrl(int);                    /* generated */
  675. extern int scroll(WINDOW *);                /* generated */
  676. extern int scrollok(WINDOW *,bool);            /* implemented */
  677. extern int scr_restore(const char *);            /* implemented */
  678. extern int scr_set(const char *);            /* implemented */
  679. #ifdef _XOPEN_SOURCE_EXTENDED
  680. extern int setcchar(cchar_t *, wchar_t *, attr_t, short, const void *);    /* missing */
  681. #endif /* _XOPEN_SOURCE_EXTENDED */
  682. extern int setscrreg(int,int);                /* generated */
  683. extern SCREEN *set_term(SCREEN *);            /* implemented */
  684. extern int slk_attroff(const attr_t);            /* implemented */
  685. extern int slk_attr_off(attr_t);            /* generated:WIDEC */
  686. extern int slk_attron(const attr_t);            /* implemented */
  687. extern int slk_attr_on(attr_t);                /* generated:WIDEC */
  688. extern int slk_attrset(const attr_t);            /* implemented */
  689. extern attr_t slk_attr(void);                           /* implemented */
  690. extern int slk_attr_set(attr_t);            /* generated:WIDEC */
  691. extern int slk_clear(void);                /* implemented */
  692. extern int slk_init(int);                /* implemented */
  693. extern char *slk_label(int);                /* implemented */
  694. extern int slk_noutrefresh(void);            /* implemented */
  695. extern int slk_refresh(void);                /* implemented */
  696. extern int slk_restore(void);                /* implemented */
  697. extern int slk_set(int,const char *,int);        /* implemented */
  698. extern int slk_touch(void);                /* implemented */
  699. #ifdef _XOPEN_SOURCE_EXTENDED
  700. extern int slk_wset(int, wchar_t *, int);        /* missing */
  701. #endif /* _XOPEN_SOURCE_EXTENDED */
  702. extern int standout(void);                /* generated */
  703. extern int standend(void);                /* generated */
  704. extern int start_color(void);                /* implemented */
  705. extern WINDOW *subpad(WINDOW *, int, int, int, int);    /* implemented */
  706. extern WINDOW *subwin(WINDOW *,int,int,int,int);    /* implemented */
  707. extern int syncok(WINDOW *, bool);            /* implemented */
  708. extern chtype termattrs(void);                /* implemented */
  709. extern attr_t term_attrs(void);                /* missing */
  710. extern char *termname(void);                /* implemented */
  711. extern int tigetflag(const char *);            /* implemented */
  712. extern int tigetnum(const char *);            /* implemented */
  713. extern char *tigetstr(const char *);            /* implemented */
  714. extern int timeout(int);                /* generated */
  715. extern int typeahead(int);                /* implemented */
  716. extern int ungetch(int);                /* implemented */
  717. #ifdef _XOPEN_SOURCE_EXTENDED
  718. extern int unget_wch(const wchar_t *);            /* missing */
  719. #endif /* _XOPEN_SOURCE_EXTENDED */
  720. extern int untouchwin(WINDOW *);            /* generated */
  721. extern void use_env(bool);                /* implemented */
  722. extern int vidattr(chtype);                /* implemented */
  723. extern int vid_attr(attr_t);                /* generated:WIDEC */
  724. extern int vidputs(chtype, int (*)(int));        /* implemented */
  725. #ifdef _XOPEN_SOURCE_EXTENDED
  726. extern int vid_puts(attr_t, int (*)(int));        /* missing */
  727. #endif /* _XOPEN_SOURCE_EXTENDED */
  728. extern int vline(chtype, int);                /* generated */
  729. #ifdef _XOPEN_SOURCE_EXTENDED
  730. extern int vline_set(const cchar_t *, int);        /* missing */
  731. #endif /* _XOPEN_SOURCE_EXTENDED */
  732. extern int vwprintw(WINDOW *,const char *,va_list);    /* implemented */
  733. extern int vw_printw(WINDOW *,const char *,va_list);    /* generated */
  734. extern int vwscanw(WINDOW *,const char *,va_list);    /* implemented */
  735. extern int vw_scanw(WINDOW *,const char *,va_list);    /* generated */
  736. extern int waddch(WINDOW *, const chtype);        /* implemented */
  737. extern int waddchnstr(WINDOW *,const chtype *const,int); /* implemented */
  738. extern int waddchstr(WINDOW *,const chtype *);        /* generated */
  739. extern int waddnstr(WINDOW *,const char *const,int);    /* implemented */
  740. extern int waddstr(WINDOW *,const char *);        /* generated */
  741. #ifdef _XOPEN_SOURCE_EXTENDED
  742. extern int waddwstr(WINDOW *,const wchar_t *);        /* missing */
  743. extern int wadd_wch(WINDOW *,const cchar_t *);        /* missing */
  744. extern int wadd_wchnstr(WINDOW *,const cchar_t *,int);    /* missing */
  745. extern int wadd_wchstr(WINDOW *,const cchar_t *);    /* missing */
  746. #endif /* _XOPEN_SOURCE_EXTENDED */
  747. extern int wattron(WINDOW *, int);            /* generated */
  748. extern int wattroff(WINDOW *, int);            /* generated */
  749. extern int wattrset(WINDOW *, int);            /* generated */
  750. extern attr_t wattr_get(WINDOW *);            /* generated */
  751. extern int wattr_on(WINDOW *, const attr_t);        /* implemented */
  752. extern int wattr_off(WINDOW *, const attr_t);        /* implemented */
  753. extern int wattr_set(WINDOW *, attr_t);            /* generated */
  754. extern int wbkgd(WINDOW *,const chtype);        /* implemented */
  755. extern void wbkgdset(WINDOW *,chtype);            /* implemented */
  756. #ifdef _XOPEN_SOURCE_EXTENDED
  757. extern int wbkgrndset(WINDOW *,const cchar_t *);    /* missing */
  758. extern int wbkgrnd(WINDOW *,const cchar_t *);        /* missing */
  759. #endif /* _XOPEN_SOURCE_EXTENDED */
  760. extern int wborder(WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);    /* implemented */
  761. #ifdef _XOPEN_SOURCE_EXTENDED
  762. extern int wborder_set(WINDOW *,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t,cchar_t);    /* missing */
  763. #endif /* _XOPEN_SOURCE_EXTENDED */
  764. extern int wchgat(WINDOW *, int, attr_t, short, const void *);/* implemented */
  765. extern int wclear(WINDOW *);                /* implemented */
  766. extern int wclrtobot(WINDOW *);                /* implemented */
  767. extern int wclrtoeol(WINDOW *);                /* implemented */
  768. extern int wcolor_set(WINDOW*,short,void*);        /* missing */
  769. extern void wcursyncup(WINDOW *);            /* implemented */
  770. extern int wdelch(WINDOW *);                /* implemented */
  771. extern int wdeleteln(WINDOW *);                /* generated */
  772. extern int wechochar(WINDOW *, const chtype);        /* implemented */
  773. #ifdef _XOPEN_SOURCE_EXTENDED
  774. extern int wecho_wchar(WINDOW *, const cchar_t *);    /* missing */
  775. #endif /* _XOPEN_SOURCE_EXTENDED */
  776. extern int werase(WINDOW *);                /* implemented */
  777. #ifdef _XOPEN_SOURCE_EXTENDED
  778. extern int wgetbkgrnd(WINDOW *, cchar_t *);        /* missing */
  779. #endif /* _XOPEN_SOURCE_EXTENDED */
  780. extern int wgetch(WINDOW *);                /* implemented */
  781. extern int wgetnstr(WINDOW *,char *,int);        /* implemented */
  782. #ifdef _XOPEN_SOURCE_EXTENDED
  783. extern int wgetn_wstr(WINDOW *,wint_t *, int);        /* missing */
  784. #endif /* _XOPEN_SOURCE_EXTENDED */
  785. extern int wgetstr(WINDOW *, char *);            /* generated */
  786. #ifdef _XOPEN_SOURCE_EXTENDED
  787. extern int wget_wch(WINDOW *, wint_t *);        /* missing */
  788. extern int wget_wstr(WINDOW *, wint_t *);        /* missing */
  789. #endif /* _XOPEN_SOURCE_EXTENDED */
  790. extern int whline(WINDOW *, chtype, int);        /* implemented */
  791. #ifdef _XOPEN_SOURCE_EXTENDED
  792. extern int whline_set(WINDOW *, const cchar_t *, int);    /* missing */
  793. #endif /* _XOPEN_SOURCE_EXTENDED */
  794. extern chtype winch(WINDOW *);                /* generated */
  795. extern int winchnstr(WINDOW *, chtype *, int);        /* implemented */
  796. extern int winchstr(WINDOW *, chtype *);        /* generated */
  797. extern int winnstr(WINDOW *, char *, int);        /* implemented */
  798. #ifdef _XOPEN_SOURCE_EXTENDED
  799. extern int winnwstr(WINDOW *, wchar_t *, int);        /* missing */
  800. #endif /* _XOPEN_SOURCE_EXTENDED */
  801. extern int winsch(WINDOW *, chtype);            /* implemented */
  802. extern int winsdelln(WINDOW *,int);            /* implemented */
  803. extern int winsertln(WINDOW *);                /* generated */
  804. extern int winsnstr(WINDOW *, const char *,int);    /* implemented */
  805. extern int winsstr(WINDOW *, const char *);        /* generated */
  806. extern int winstr(WINDOW *, char *);            /* generated */
  807. #ifdef _XOPEN_SOURCE_EXTENDED
  808. extern int wins_nwstr(WINDOW *, const wchar_t *, int);    /* missing */
  809. extern int wins_wch(WINDOW *, const cchar_t *);        /* missing */
  810. extern int wins_wstr(WINDOW *, const wchar_t *);    /* missing */
  811. extern int winwstr(WINDOW *, wchar_t *);        /* missing */
  812. extern int win_wch(WINDOW *, const cchar_t *);        /* missing */
  813. extern int win_wchnstr(WINDOW *, const cchar_t *, int);    /* missing */
  814. extern int win_wchstr(WINDOW *, const cchar_t *);    /* missing */
  815. #endif /* _XOPEN_SOURCE_EXTENDED */
  816. extern int wmove(WINDOW *,int,int);            /* implemented */
  817. extern int wnoutrefresh(WINDOW *);            /* implemented */
  818. extern int wprintw(WINDOW *,const char *,...)        /* implemented */
  819.         GCC_PRINTFLIKE(2,3);
  820. extern int wredrawln(WINDOW *,int,int);            /* implemented */
  821. extern int wrefresh(WINDOW *);                /* implemented */
  822. extern int wscanw(WINDOW *,const char *,...)        /* implemented */
  823.         GCC_SCANFLIKE(2,3);
  824. extern int wscrl(WINDOW *,int);                /* implemented */
  825. extern int wsetscrreg(WINDOW *,int,int);        /* implemented */
  826. extern int wstandout(WINDOW *);                /* generated */
  827. extern int wstandend(WINDOW *);                /* generated */
  828. extern void wsyncdown(WINDOW *);            /* implemented */
  829. extern void wsyncup(WINDOW *);                /* implemented */
  830. extern int wtimeout(WINDOW *,int);            /* implemented */
  831. extern int wtouchln(WINDOW *,int,int,int);        /* implemented */
  832. #ifdef _XOPEN_SOURCE_EXTENDED
  833. extern wchar_t wunctrl(cchar_t *);            /* missing */
  834. #endif /* _XOPEN_SOURCE_EXTENDED */
  835. extern int wvline(WINDOW *,chtype,int);            /* implemented */
  836. #ifdef _XOPEN_SOURCE_EXTENDED
  837. extern int wvline_set(WINDOW *, const cchar_t *, int);    /* missing */
  838. #endif /* _XOPEN_SOURCE_EXTENDED */
  839.  
  840. /* attributes */
  841.  
  842. #define NCURSES_BITS(mask,shift) ((mask) << ((shift) + 16))
  843.  
  844. #define A_NORMAL    0L
  845. #define A_ATTRIBUTES    NCURSES_BITS(~(1UL - 1UL),0)
  846. #define A_CHARTEXT    (NCURSES_BITS(1UL,0) - 1UL)
  847. #define A_COLOR        NCURSES_BITS(((1UL) << 8) - 1UL,0)
  848. #define A_STANDOUT    NCURSES_BITS(1UL,8)
  849. #define A_UNDERLINE    NCURSES_BITS(1UL,9)
  850. #define A_REVERSE    NCURSES_BITS(1UL,10)
  851. #define A_BLINK        NCURSES_BITS(1UL,11)
  852. #define A_DIM        NCURSES_BITS(1UL,12)
  853. #define A_BOLD        NCURSES_BITS(1UL,13)
  854. #define A_ALTCHARSET    NCURSES_BITS(1UL,14)
  855. #define A_INVIS        NCURSES_BITS(1UL,15)
  856.  
  857. /* Tradeoff on 32-bit machines ('protect' vs widec).  The others (e.g., left
  858.  * highlight are not implemented in any terminal descriptions, anyway.
  859.  */
  860. #if ((16 + 16) < 32)
  861. #define A_PROTECT    NCURSES_BITS(1UL,16)
  862. #define A_HORIZONTAL    NCURSES_BITS(1UL,17)
  863. #define A_LEFT        NCURSES_BITS(1UL,18)
  864. #define A_LOW        NCURSES_BITS(1UL,19)
  865. #define A_RIGHT        NCURSES_BITS(1UL,20)
  866. #define A_TOP        NCURSES_BITS(1UL,21)
  867. #define A_VERTICAL    NCURSES_BITS(1UL,22)
  868. #else
  869. #define A_PROTECT    0L
  870. #define A_HORIZONTAL    0L
  871. #define A_LEFT        0L
  872. #define A_LOW        0L
  873. #define A_RIGHT        0L
  874. #define A_TOP        0L
  875. #define A_VERTICAL    0L
  876. #endif
  877.  
  878. #define COLOR_PAIR(n)    NCURSES_BITS(n, 0)
  879. #define PAIR_NUMBER(a)    (((a) & A_COLOR) >> 16)
  880.  
  881. /*
  882.  * pseudo functions
  883.  */
  884. #define wgetstr(w, s)        wgetnstr(w, s, -1)
  885. #define getnstr(s, n)        wgetnstr(stdscr, s, n)
  886.  
  887. #define setterm(term)        setupterm(term, 1, (int *)0)
  888.  
  889. #define fixterm()        reset_prog_mode()
  890. #define resetterm()        reset_shell_mode()
  891. #define saveterm()        def_prog_mode()
  892. #define crmode()        cbreak()
  893. #define nocrmode()        nocbreak()
  894. #define gettmode()
  895.  
  896. #define getyx(win,y,x)       (y = (win)?(win)->_cury:ERR, x = (win)?(win)->_curx:ERR)
  897. #define getbegyx(win,y,x)    (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR)
  898. #define getmaxyx(win,y,x)    (y = (win)?((win)->_maxy + 1):ERR, x = (win)?((win)->_maxx + 1):ERR)
  899. #define getparyx(win,y,x)    (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR)
  900. #define getsyx(y,x)        getyx(stdscr, y, x)
  901. #define setsyx(y,x)        (stdscr->_cury = y, stdscr->_curx = x)
  902.  
  903. /* It seems older SYSV curses versions define these */
  904. #define getattrs(win)        ((win)?(win)->_attrs:A_NORMAL)
  905. #define getcurx(win)        ((win)?(win)->_curx:ERR)
  906. #define getcury(win)        ((win)?(win)->_cury:ERR)
  907. #define getbegx(win)        ((win)?(win)->_begx:ERR)
  908. #define getbegy(win)        ((win)?(win)->_begy:ERR)
  909. #define getmaxx(win)        ((win)?((win)->_maxx + 1):ERR)
  910. #define getmaxy(win)        ((win)?((win)->_maxy + 1):ERR)
  911. #define getparx(win)        ((win)?(win)->_parx:ERR)
  912. #define getpary(win)        ((win)?(win)->_pary:ERR)
  913.  
  914. #define winch(win)           ((win)?(win)->_line[(win)->_cury].text[(win)->_curx]:0)
  915. #define wstandout(win)          (wattr_set(win,A_STANDOUT))
  916. #define wstandend(win)          (wattr_set(win,A_NORMAL))
  917. #define wattr_set(win,at)        ((win)?((win)->_attrs = (at)):0)
  918.  
  919. #define wattron(win,at)        wattr_on(win, at)
  920. #define wattroff(win,at)    wattr_off(win, at)
  921. #define wattrset(win,at)        wattr_set(win, at)
  922.  
  923. #define scroll(win)        wscrl(win,1)
  924.  
  925. #define touchwin(win)        wtouchln((win), 0, getmaxy(win), 1)
  926. #define touchline(win, s, c)    wtouchln((win), s, c, 1)
  927. #define untouchwin(win)        wtouchln((win), 0, getmaxy(win), 0)
  928.  
  929. #define box(win, v, h)        wborder(win, v, v, h, h, 0, 0, 0, 0)
  930. #define border(ls, rs, ts, bs, tl, tr, bl, br)    wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)
  931. #define hline(ch, n)        whline(stdscr, ch, n)
  932. #define vline(ch, n)        wvline(stdscr, ch, n)
  933.  
  934. #define winstr(w, s)        winnstr(w, s, -1)
  935. #define winchstr(w, s)        winchnstr(w, s, -1)
  936. #define winsstr(w, s)        winsnstr(w, s, -1)
  937.  
  938. #define redrawwin(w)        wredrawln(w, 0, w->_maxy+1)
  939. #define waddstr(win,str)    waddnstr(win,str,-1)
  940. #define waddchstr(win,str)    waddchnstr(win,str,-1)
  941.  
  942. /*
  943.  * pseudo functions for standard screen
  944.  */
  945.  
  946. #define addch(ch)              waddch(stdscr,ch)
  947. #define addchnstr(str,n)    waddchnstr(stdscr,str,n)
  948. #define addchstr(str)        waddchstr(stdscr,str)
  949. #define addnstr(str,n)        waddnstr(stdscr,str,n)
  950. #define addstr(str)            waddnstr(stdscr,str,-1)
  951. #define attroff(at)            wattroff(stdscr,at)
  952. #define attron(at)             wattron(stdscr,at)
  953. #define attrset(at)            wattrset(stdscr,at)
  954. #define bkgd(ch)        wbkgd(stdscr,ch)
  955. #define bkgdset(ch)        wbkgdset(stdscr,ch)
  956. #define clear()                wclear(stdscr)
  957. #define clrtobot()             wclrtobot(stdscr)
  958. #define clrtoeol()             wclrtoeol(stdscr)
  959. #define delch()                wdelch(stdscr)
  960. #define deleteln()             winsdelln(stdscr,-1)
  961. #define echochar(c)        wechochar(stdscr,c)
  962. #define erase()                werase(stdscr)
  963. #define getch()                wgetch(stdscr)
  964. #define getstr(str)            wgetstr(stdscr,str)
  965. #define inch()               winch(stdscr)
  966. #define inchnstr(s,n)        winchnstr(stdscr,s,n)
  967. #define inchstr(s)        winchstr(stdscr,s)
  968. #define innstr(s,n)        winnstr(stdscr,s,n)
  969. #define insch(c)               winsch(stdscr,c)
  970. #define insdelln(n)        winsdelln(stdscr,n)
  971. #define insertln()             winsdelln(stdscr,1)
  972. #define insnstr(s,n)        winsnstr(stdscr,s,n)
  973. #define insstr(s)        winsstr(stdscr,s)
  974. #define instr(s)        winstr(stdscr,s)
  975. #define move(y,x)             wmove(stdscr,y,x)
  976. #define refresh()              wrefresh(stdscr)
  977. #define scrl(n)            wscrl(stdscr,n)
  978. #define setscrreg(t,b)         wsetscrreg(stdscr,t,b)
  979. #define standend()             wstandend(stdscr)
  980. #define standout()             wstandout(stdscr)
  981. #define timeout(delay)        wtimeout(stdscr,delay)
  982. #define wdeleteln(win)         winsdelln(win,-1)
  983. #define winsertln(win)         winsdelln(win,1)
  984.  
  985. /*
  986.  * mv functions
  987.  */
  988.  
  989. #define mvwaddch(win,y,x,ch)        (wmove(win,y,x) == ERR ? ERR : waddch(win,ch))
  990. #define mvwaddchnstr(win,y,x,str,n)    (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))
  991. #define mvwaddchstr(win,y,x,str)      (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))
  992. #define mvwaddnstr(win,y,x,str,n)    (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))
  993. #define mvwaddstr(win,y,x,str)      (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))
  994. #define mvwdelch(win,y,x)           (wmove(win,y,x) == ERR ? ERR : wdelch(win))
  995. #define mvwgetch(win,y,x)           (wmove(win,y,x) == ERR ? ERR : wgetch(win))
  996. #define mvwgetnstr(win,y,x,str,n)        (wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n))
  997. #define mvwgetstr(win,y,x,str)          (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))
  998. #define mvwhline(win,y,x,c,n)         (wmove(win,y,x) == ERR ? ERR : whline(win,c,n))
  999. #define mvwinch(win,y,x)            (wmove(win,y,x) == ERR ? (chtype)ERR : winch(win))
  1000. #define mvwinchnstr(win,y,x,s,n)    (wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))
  1001. #define mvwinchstr(win,y,x,s)        (wmove(win,y,x) == ERR ? ERR : winchstr(win,s))
  1002. #define mvwinnstr(win,y,x,s,n)        (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))
  1003. #define mvwinsch(win,y,x,c)         (wmove(win,y,x) == ERR ? ERR : winsch(win,c))
  1004. #define mvwinsnstr(win,y,x,s,n)        (wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))
  1005. #define mvwinsstr(win,y,x,s)        (wmove(win,y,x) == ERR ? ERR : winsstr(win,s))
  1006. #define mvwinstr(win,y,x,s)        (wmove(win,y,x) == ERR ? ERR : winstr(win,s))
  1007. #define mvwvline(win,y,x,c,n)         (wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))
  1008.  
  1009. #define mvaddch(y,x,ch)             mvwaddch(stdscr,y,x,ch)
  1010. #define mvaddchnstr(y,x,str,n)        mvwaddchnstr(stdscr,y,x,str,n)
  1011. #define mvaddchstr(y,x,str)        mvwaddchstr(stdscr,y,x,str)
  1012. #define mvaddnstr(y,x,str,n)        mvwaddnstr(stdscr,y,x,str,n)
  1013. #define mvaddstr(y,x,str)           mvwaddstr(stdscr,y,x,str)
  1014. #define mvdelch(y,x)                mvwdelch(stdscr,y,x)
  1015. #define mvgetch(y,x)                mvwgetch(stdscr,y,x)
  1016. #define mvgetnstr(y,x,str,n)        mvwgetnstr(stdscr,y,x,str,n)
  1017. #define mvgetstr(y,x,str)               mvwgetstr(stdscr,y,x,str)
  1018. #define mvhline(y,x,c,n)        mvwhline(stdscr,y,x,c,n)
  1019. #define mvinch(y,x)                 mvwinch(stdscr,y,x)
  1020. #define mvinchnstr(y,x,s,n)        mvwinchnstr(stdscr,y,x,s,n)
  1021. #define mvinchstr(y,x,s)        mvwinchstr(stdscr,y,x,s)
  1022. #define mvinnstr(y,x,s,n)        mvwinnstr(stdscr,y,x,s,n)
  1023. #define mvinsch(y,x,c)              mvwinsch(stdscr,y,x,c)
  1024. #define mvinsnstr(y,x,s,n)        mvwinsnstr(stdscr,y,x,s,n)
  1025. #define mvinsstr(y,x,s)            mvwinsstr(stdscr,y,x,s)
  1026. #define mvinstr(y,x,s)            mvwinstr(stdscr,y,x,s)
  1027. #define mvvline(y,x,c,n)        mvwvline(stdscr,y,x,c,n)
  1028.  
  1029. /*
  1030.  * XSI curses macros for XPG4 conformance.
  1031.  * The underlying functions needed to make these work are:
  1032.  * waddnwstr(), waddchnwstr(), wadd_wch(), wborder_set(), wchgat(),
  1033.  * wecho_wchar(), wgetn_wstr(), wget_wch(), whline_set(), vhline_set(),
  1034.  * winnwstr(), wins_nwstr(), wins_wch(), win_wch(), win_wchnstr().
  1035.  * Except for wchgat(), these are not yet implemented.  They will be someday.
  1036.  */
  1037. #define add_wch(c)            wadd_wch(stsdscr,c)
  1038. #define addnwstr(wstr,n)        waddnwstr(stdscr,wstr,n)
  1039. #define addwstr(wstr,n)            waddnwstr(stdscr,wstr,-1)
  1040. #define attr_get()            wattr_get(stdscr)
  1041. #define attr_off(a)            wattr_off(stdscr,a)
  1042. #define attr_on(a)            wattr_on(stdscr,a)
  1043. #define attr_set(a)            wattr_set(stdscr,a)
  1044. #define box_set(w,v,h)            wborder_set(w,v,v,h,h,0,0,0,9)
  1045. #define chgat(n,a,c,o)            wchgat(stdscr,n,a,c,o)
  1046. #define echo_wchar(c)            wecho_wchar(stdscr,c)
  1047. #define getbkgd(win)            ((win)->_bkgd)
  1048. #define get_wch(c)            wget_wch(stdscr,c)
  1049. #define get_wstr(t)            wgetn_wstr(stdscr,t,-1)
  1050. #define getn_wstr(t,n)            wgetn_wstr(stdscr,t,n)
  1051. #define hline_set(c,n)            whline_set(stdscr,c,n)
  1052. #define in_wch(c)            win_wch(stdscr,c)
  1053. #define in_wchnstr(c,n)            win_wchnstr(stdscr,c,n)
  1054. #define in_wchstr(c)            win_wchnstr(stdscr,c,-1)
  1055. #define innwstr(c,n)            winnwstr(stdscr,c,n)
  1056. #define ins_nwstr(t,n)            wins_nwstr(stdscr,t,n)
  1057. #define ins_wch(c)            wins_wch(stdscr,c)
  1058. #define ins_wstr(t)            wins_nwstr(stdscr,t,-1)
  1059. #define inwstr(c)            winnwstr(stdscr,c,-1)
  1060.  
  1061. #define mvadd_wch(y,x,c)        mvwadd_wch(stdscr,y,x,c)
  1062. #define mvaddnwstr(y,x,wstr,n)        mvwaddnwstr(stdscr,y,x,wstr,n)
  1063. #define mvaddwstr(y,x,wstr,n)        mvwaddnwstr(stdscr,y,x,wstr,-1)
  1064. #define mvchgat(y,x,n,a,c,o)        mvwchgat(stdscr,y,x,n,a,c,o)
  1065. #define mvget_wch(y,x,c)        mvwget_wch(stdscr,y,x,c)
  1066. #define mvget_wstr(y,x,t)        mvwgetn_wstr(stdscr,y,x,t,-1)
  1067. #define mvgetn_wstr(y,x,t,n)        mvwgetn_wstr(stdscr,y,x,t,n)
  1068. #define mvhline_set(y,x,c,n)        mvwhline_set(stdscr,y,x,c,n)
  1069. #define mvin_wch(y,x,c)            mvwin_wch(stdscr,y,x,c)
  1070. #define mvin_wchnstr(y,x,c,n)        mvwin_wchnstr(stdscr,y,x,c,n)
  1071. #define mvin_wchstr(y,x,c)        mvwin_wchnstr(stdscr,y,x,c,-1)
  1072. #define mvinnwstr(y,x,c,n)        mvwinnwstr(stdscr,y,x,c,n)
  1073. #define mvins_nwstr(y,x,t,n)        mvwins_nwstr(stdscr,y,x,t,n)
  1074. #define mvins_wch(y,x,c)        mvwins_wch(stdscr,y,x,c)
  1075. #define mvins_wstr(y,x,t)        mvwins_nwstr(stdscr,y,x,t,-1)
  1076. #define mvinwstr(y,x,c)            mvwinnwstr(stdscr,y,x,c,-1)
  1077. #define mvvline_set(y,x,c,n)        mvwvline_set(stdscr,y,x,c,n)
  1078.  
  1079. #define mvwadd_wch(y,x,win,c)        (wmove(win,y,x) == ERR ? ERR : wadd_wch(stsdscr,c))
  1080. #define mvwaddnwstr(y,x,win,wstr,n)    (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,n))
  1081. #define mvwaddwstr(y,x,win,wstr,n)    (wmove(win,y,x) == ERR ? ERR : waddnwstr(stdscr,wstr,-1))
  1082. #define mvwchgat(win,y,x,n,a,c,o)    (wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))
  1083. #define mvwget_wch(win,y,x,c)        (wmove(win,y,x) == ERR ? ERR : wget_wch(win,n))
  1084. #define mvwget_wstr(win,y,x,t)        (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,-1))
  1085. #define mvwgetn_wstr(win,y,x,t,n)    (wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,n))
  1086. #define mvwhline_set(win,y,x,c,n)    (wmove(win,y,x) == ERR ? ERR : whline_set(win,c,n))
  1087. #define mvwin_wch(win,y,x,c)        (wmove(win,y,x) == ERR ? ERR : win_wch(win,c))
  1088. #define mvwin_wchnstr(win,y,x,c,n)    (wmove(win,y,x) == ERR ? ERR : win_wchnstr(stdscr,c,n))
  1089. #define mvwin_wchstr(win,y,x,c)        (wmove(win,y,x) == ERR ? ERR : win_wchnstr(stdscr,c,-1))
  1090. #define mvwinnwstr(win,y,x,c,n)        (wmove(win,y,x) == ERR ? ERR : winnwstr(stdscr,c,n))
  1091. #define mvwins_nwstr(win,y,x,t,n)    (wmove(win,y,x) == ERR ? ERR : wins_nwstr(stdscr,t,n))
  1092. #define mvwins_wch(win,y,x,c)        (wmove(win,y,x) == ERR ? ERR : wins_wch(c))
  1093. #define mvwins_wstr(win,y,x,t)        (wmove(win,y,x) == ERR ? ERR : wins_nwstr(stdscr,t,-1))
  1094. #define mvwinwstr(win,y,x,c)        (wmove(win,y,x) == ERR ? ERR : winnwstr(stdscr,c,-1))
  1095. #define mvwvline_set(win,y,x,c,n)    (wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n))
  1096.  
  1097. #define slk_attr_off(a)            slk_attroff(a)
  1098. #define slk_attr_on(a)            slk_attron(a)
  1099. #define slk_attr_set(a)            slk_attrset(a)
  1100. #define vid_attr(a)            vidattr(a)
  1101. #define vline_set(c,n)            vhline_set(stdscr,c,n)
  1102. #define waddwstr(win,wstr,n)        waddnwstr(win,wstr,-1)
  1103. #define wattr_get(win)            ((win)->_attrs)
  1104. #define wget_wstr(w,t)            wgetn_wstr(w,t,-1)
  1105. #define win_wchstr(w,c)            win_wchnstr(w,c,-1)
  1106. #define wins_wstr(w,t)            wins_nwstr(w,t,-1)
  1107. #define winwstr(w,c)            winnwstr(w,c,-1)
  1108.  
  1109.  
  1110. /*
  1111.  * XSI curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use
  1112.  * varargs.h.  It adds new calls vw_printw/vw_scanw, which are supposed to
  1113.  * use POSIX stdarg.h.  The ncurses versions of vwprintw/vwscanw already
  1114.  * use stdarg.h, so...
  1115.  */
  1116. #define vw_printw        vwprintw
  1117. #define vw_scanw        vwscanw
  1118.  
  1119. /*
  1120.  * Pseudo-character tokens outside ASCII range.  The curses wgetch() function
  1121.  * will return any given one of these only if the corresponding k- capability
  1122.  * is defined in your terminal's terminfo entry.
  1123.  */
  1124. #define KEY_CODE_YES    0400        /* A wchar_t contains a key code */
  1125. #define KEY_MIN        0401        /* Minimum curses key */
  1126. #define KEY_BREAK       0401            /* Break key (unreliable) */
  1127. #define KEY_DOWN        0402            /* Down-arrow */
  1128. #define KEY_UP          0403        /* Up-arrow */
  1129. #define KEY_LEFT        0404        /* Left-arrow */
  1130. #define KEY_RIGHT       0405            /* Right-arrow */
  1131. #define KEY_HOME        0406            /* Home key (upward+left arrow) */
  1132. #define KEY_BACKSPACE   0407            /* Backspace (unreliable) */
  1133. #define KEY_F0          0410            /* Function keys.  Space for 64 */
  1134. #define KEY_F(n)        (KEY_F0+(n))    /* Value of function key n */
  1135. #define KEY_DL          0510            /* Delete line */
  1136. #define KEY_IL          0511            /* Insert line */
  1137. #define KEY_DC          0512            /* Delete character */
  1138. #define KEY_IC          0513            /* Insert char or enter insert mode */
  1139. #define KEY_EIC         0514            /* Exit insert char mode */
  1140. #define KEY_CLEAR       0515            /* Clear screen */
  1141. #define KEY_EOS         0516            /* Clear to end of screen */
  1142. #define KEY_EOL         0517            /* Clear to end of line */
  1143. #define KEY_SF          0520            /* Scroll 1 line forward */
  1144. #define KEY_SR          0521            /* Scroll 1 line backward (reverse) */
  1145. #define KEY_NPAGE       0522            /* Next page */
  1146. #define KEY_PPAGE       0523            /* Previous page */
  1147. #define KEY_STAB        0524            /* Set tab */
  1148. #define KEY_CTAB        0525            /* Clear tab */
  1149. #define KEY_CATAB       0526            /* Clear all tabs */
  1150. #define KEY_ENTER       0527            /* Enter or send (unreliable) */
  1151. #define KEY_SRESET      0530            /* Soft (partial) reset (unreliable) */
  1152. #define KEY_RESET       0531            /* Reset or hard reset (unreliable) */
  1153. #define KEY_PRINT       0532            /* Print */
  1154. #define KEY_LL          0533            /* Home down or bottom (lower left) */
  1155.  
  1156. /* The keypad is arranged like this: */
  1157. /* a1    up    a3   */
  1158. /* left   b2  right  */
  1159. /* c1   down   c3   */
  1160.  
  1161. #define KEY_A1        0534        /* Upper left of keypad */
  1162. #define KEY_A3        0535        /* Upper right of keypad */
  1163. #define KEY_B2        0536        /* Center of keypad */
  1164. #define KEY_C1        0537        /* Lower left of keypad */
  1165. #define KEY_C3        0540        /* Lower right of keypad */
  1166. #define KEY_BTAB    0541        /* Back tab */
  1167. #define KEY_BEG        0542        /* Beg (beginning) */
  1168. #define KEY_CANCEL    0543        /* Cancel */
  1169. #define KEY_CLOSE    0544        /* Close */
  1170. #define KEY_COMMAND    0545        /* Cmd (command) */
  1171. #define KEY_COPY    0546        /* Copy */
  1172. #define KEY_CREATE    0547        /* Create */
  1173. #define KEY_END        0550        /* End */
  1174. #define KEY_EXIT    0551        /* Exit */
  1175. #define KEY_FIND    0552        /* Find */
  1176. #define KEY_HELP    0553        /* Help */
  1177. #define KEY_MARK    0554        /* Mark */
  1178. #define KEY_MESSAGE    0555        /* Message */
  1179. #define KEY_MOVE    0556        /* Move */
  1180. #define KEY_NEXT    0557        /* Next */
  1181. #define KEY_OPEN    0560        /* Open */
  1182. #define KEY_OPTIONS    0561        /* Options */
  1183. #define KEY_PREVIOUS    0562        /* Prev (previous) */
  1184. #define KEY_REDO    0563        /* Redo */
  1185. #define KEY_REFERENCE    0564        /* Ref (reference) */
  1186. #define KEY_REFRESH    0565        /* Refresh */
  1187. #define KEY_REPLACE    0566        /* Replace */
  1188. #define KEY_RESTART    0567        /* Restart */
  1189. #define KEY_RESUME    0570        /* Resume */
  1190. #define KEY_SAVE    0571        /* Save */
  1191. #define KEY_SBEG    0572        /* Shifted Beg (beginning) */
  1192. #define KEY_SCANCEL    0573        /* Shifted Cancel */
  1193. #define KEY_SCOMMAND    0574        /* Shifted Command */
  1194. #define KEY_SCOPY    0575        /* Shifted Copy */
  1195. #define KEY_SCREATE    0576        /* Shifted Create */
  1196. #define KEY_SDC        0577        /* Shifted Delete char */
  1197. #define KEY_SDL        0600        /* Shifted Delete line */
  1198. #define KEY_SELECT    0601        /* Select */
  1199. #define KEY_SEND    0602        /* Shifted End */
  1200. #define KEY_SEOL    0603        /* Shifted Clear line */
  1201. #define KEY_SEXIT    0604        /* Shifted Dxit */
  1202. #define KEY_SFIND    0605        /* Shifted Find */
  1203. #define KEY_SHELP    0606        /* Shifted Help */
  1204. #define KEY_SHOME    0607        /* Shifted Home */
  1205. #define KEY_SIC        0610        /* Shifted Input */
  1206. #define KEY_SLEFT    0611        /* Shifted Left arrow */
  1207. #define KEY_SMESSAGE    0612        /* Shifted Message */
  1208. #define KEY_SMOVE    0613        /* Shifted Move */
  1209. #define KEY_SNEXT    0614        /* Shifted Next */
  1210. #define KEY_SOPTIONS    0615        /* Shifted Options */
  1211. #define KEY_SPREVIOUS    0616        /* Shifted Prev */
  1212. #define KEY_SPRINT    0617        /* Shifted Print */
  1213. #define KEY_SREDO    0620        /* Shifted Redo */
  1214. #define KEY_SREPLACE    0621        /* Shifted Replace */
  1215. #define KEY_SRIGHT    0622        /* Shifted Right arrow */
  1216. #define KEY_SRSUME    0623        /* Shifted Resume */
  1217. #define KEY_SSAVE    0624        /* Shifted Save */
  1218. #define KEY_SSUSPEND    0625        /* Shifted Suspend */
  1219. #define KEY_SUNDO    0626        /* Shifted Undo */
  1220. #define KEY_SUSPEND    0627        /* Suspend */
  1221. #define KEY_UNDO    0630        /* Undo */
  1222. #define KEY_MOUSE    0631        /* Mouse event has occurred */
  1223. #define KEY_RESIZE    0632        /* Terminal resize event */
  1224. #define KEY_MAX        0777        /* Maximum key value */
  1225.  
  1226. /* mouse interface */
  1227. #define NCURSES_MOUSE_VERSION    1
  1228.  
  1229. /* event masks */
  1230. #define    BUTTON1_RELEASED    000000000001L
  1231. #define    BUTTON1_PRESSED        000000000002L
  1232. #define    BUTTON1_CLICKED        000000000004L
  1233. #define    BUTTON1_DOUBLE_CLICKED    000000000010L
  1234. #define    BUTTON1_TRIPLE_CLICKED    000000000020L
  1235. #define BUTTON1_RESERVED_EVENT    000000000040L
  1236. #define    BUTTON2_RELEASED    000000000100L
  1237. #define    BUTTON2_PRESSED        000000000200L
  1238. #define    BUTTON2_CLICKED        000000000400L
  1239. #define    BUTTON2_DOUBLE_CLICKED    000000001000L
  1240. #define    BUTTON2_TRIPLE_CLICKED    000000002000L
  1241. #define BUTTON2_RESERVED_EVENT    000000004000L
  1242. #define    BUTTON3_RELEASED    000000010000L
  1243. #define    BUTTON3_PRESSED        000000020000L
  1244. #define    BUTTON3_CLICKED        000000040000L
  1245. #define    BUTTON3_DOUBLE_CLICKED    000000100000L
  1246. #define    BUTTON3_TRIPLE_CLICKED    000000200000L
  1247. #define BUTTON3_RESERVED_EVENT    000000400000L
  1248. #define    BUTTON4_RELEASED    000001000000L
  1249. #define    BUTTON4_PRESSED        000002000000L
  1250. #define    BUTTON4_CLICKED        000004000000L
  1251. #define    BUTTON4_DOUBLE_CLICKED    000010000000L
  1252. #define    BUTTON4_TRIPLE_CLICKED    000020000000L
  1253. #define BUTTON4_RESERVED_EVENT    000040000000L
  1254. #define BUTTON_CTRL        000100000000L
  1255. #define BUTTON_SHIFT        000200000000L
  1256. #define BUTTON_ALT        000400000000L
  1257. #define    ALL_MOUSE_EVENTS    000777777777L
  1258. #define    REPORT_MOUSE_POSITION    001000000000L
  1259.  
  1260. /* macros to extract single event-bits from masks */
  1261. #define    BUTTON_RELEASE(e, x)        ((e) & (001 << (6 * ((x) - 1))))
  1262. #define    BUTTON_PRESS(e, x)        ((e) & (002 << (6 * ((x) - 1))))
  1263. #define    BUTTON_CLICK(e, x)        ((e) & (004 << (6 * ((x) - 1))))
  1264. #define    BUTTON_DOUBLE_CLICK(e, x)    ((e) & (010 << (6 * ((x) - 1))))
  1265. #define    BUTTON_TRIPLE_CLICK(e, x)    ((e) & (020 << (6 * ((x) - 1))))
  1266. #define    BUTTON_RESERVED_EVENT(e, x)    ((e) & (040 << (6 * ((x) - 1))))
  1267.  
  1268. typedef unsigned long mmask_t;
  1269.  
  1270. typedef struct
  1271. {
  1272.     short id;        /* ID to distinguish multiple devices */
  1273.     int x, y, z;    /* event coordinates (character-cell) */
  1274.     mmask_t bstate;    /* button state bits */
  1275. }
  1276. MEVENT;
  1277.  
  1278. extern int getmouse(MEVENT *);
  1279. extern int ungetmouse(MEVENT *);
  1280. extern mmask_t mousemask(mmask_t, mmask_t *);
  1281. extern bool wenclose(const WINDOW *, int, int);
  1282. extern int mouseinterval(int);
  1283.  
  1284. /* other non-XSI functions */
  1285.  
  1286. extern int mcprint(char *, int);    /* direct data to printer */
  1287. extern int has_key(int);        /* do we have given key? */
  1288.  
  1289. /* Debugging : use with libncurses_g.a */
  1290.  
  1291. extern void _tracef(const char *, ...) GCC_PRINTFLIKE(1,2);
  1292. extern void _tracedump(const char *, WINDOW *);
  1293. extern char *_traceattr(attr_t);
  1294. extern char *_traceattr2(int, chtype);
  1295. extern char *_tracebits(void);
  1296. extern char *_tracechar(const unsigned char);
  1297. extern char *_tracechtype(chtype);
  1298. extern char *_tracechtype2(int, chtype);
  1299. extern char *_tracemouse(const MEVENT *);
  1300. extern void trace(const unsigned int);
  1301.  
  1302. /* trace masks */
  1303. #define TRACE_DISABLE    0x0000    /* turn off tracing */
  1304. #define TRACE_TIMES    0x0001    /* trace user and system times of updates */
  1305. #define TRACE_TPUTS    0x0002    /* trace tputs calls */
  1306. #define TRACE_UPDATE    0x0004    /* trace update actions, old & new screens */
  1307. #define TRACE_MOVE    0x0008    /* trace cursor moves and scrolls */
  1308. #define TRACE_CHARPUT    0x0010    /* trace all character outputs */
  1309. #define TRACE_ORDINARY    0x001F    /* trace all update actions */
  1310. #define TRACE_CALLS    0x0020    /* trace all curses calls */
  1311. #define TRACE_VIRTPUT    0x0040    /* trace virtual character puts */
  1312. #define TRACE_IEVENT    0x0080    /* trace low-level input processing */
  1313. #define TRACE_BITS    0x0100    /* trace state of TTY control bits */
  1314. #define TRACE_ICALLS    0x0200    /* trace internal/nested calls */
  1315. #define TRACE_CCALLS    0x0400    /* trace per-character calls */
  1316. #define TRACE_MAXIMUM    0xffff    /* maximum trace level */
  1317.  
  1318. #if defined(TRACE) || defined(NCURSES_TEST)
  1319. extern int _nc_optimize_enable;        /* enable optimizations */
  1320. extern const char *_nc_visbuf(const char *);
  1321. #define OPTIMIZE_MVCUR        0x01    /* cursor movement optimization */
  1322. #define OPTIMIZE_HASHMAP    0x02    /* diff hashing to detect scrolls */
  1323. #define OPTIMIZE_SCROLL        0x04    /* scroll optimization */
  1324. #define OPTIMIZE_ALL        0xff    /* enable all optimizations (dflt) */
  1325. #endif
  1326.  
  1327. #ifdef __cplusplus
  1328. }
  1329. #endif
  1330.  
  1331. #endif /* __NCURSES_H */
  1332.